<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<!--[if IE 9 ]><html class="ie9"><![endif]-->
<head>
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="format-detection" content="telephone=no">
<meta charset="UTF-8">

<meta name="description" content="Violate Responsive Admin Template">
<meta name="keywords" content="Super Admin, Admin, Template, Bootstrap">

<title>用户管理</title>

<!-- CSS -->
<link
	href="${pageContext.request.contextPath}/admin/css/bootstrap.min.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/admin/css/animate.min.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/admin/css/font-awesome.min.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/admin/css/form.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/admin/css/calendar.css"
	rel="stylesheet">
<link
	href="${pageContext.request.contextPath}/admin/css/media-player.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/admin/css/style.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/admin/css/icons.css"
	rel="stylesheet">
<link href="${pageContext.request.contextPath}/admin/css/generics.css"
	rel="stylesheet">

	 <script src="${pageContext.request.contextPath}/admin/assets/js/jquery.min.js"></script>
</head>
<body id="skin-blur-violate">
	<header id="header" class="media">
		<a href="" id="menu-toggle"></a> <a class="logo pull-left"
			href="index.html">资源管理</a>

		<div class="media-body">
			<div class="media" id="top-menu">


				<div id="time" class="pull-right">
					<span id="hours"></span> : <span id="min"></span> : <span id="sec"></span>
				</div>

				<div class="media-body">
					<input type="text" class="main-search">
				</div>
			</div>
		</div>
	</header>

	<div class="clearfix"></div>

	<section class="p-relative" role="main">

		<!-- Sidebar -->
		<aside id="sidebar">

			<!-- Sidbar Widgets -->
			<div class="side-widgets overflow">
				<!-- Profile Menu -->
				<div class="text-center s-widget m-b-25 dropdown" id="profile-menu">
					<a href="" data-toggle="dropdown"> <img
						class="profile-pic animated"
						src="${pageContext.request.contextPath}/admin/img/1.jpg" alt="">
					</a>
					<ul class="dropdown-menu profile-menu">
						    <li><a href="${pageContext.request.contextPath}/music/listadmin">转到音乐播放界面</a> <i class="icon left">&#61903;</i><i class="icon right">&#61815;</i></li>
                            <li><a href="${pageContext.request.contextPath}/video/listadmin">转到视频播放界面</a> <i class="icon left">&#61903;</i><i class="icon right">&#61815;</i></li>  
                           <li> <a href="${pageContext.request.contextPath}/system/user/login">退出登陆</a><i class="icon left">&#61903;</i><i class="icon right">&#61815;</i></li>
					</ul>
					<h4 class="m-0">管理员</h4>

				</div>

				<!-- Calendar -->
				<div class="s-widget m-b-25">
					<div id="sidebar-calendar"></div>
				</div>



			</div>

			<!-- Side Menu -->
			<ul class="list-unstyled side-menu">
				<li><a class="sa-side-home"
					href="${pageContext.request.contextPath}/admin/index.jsp"> <span
						class="menu-item">主页</span> </a></li>
				<li><a class="sa-side-typography"
					href="${pageContext.request.contextPath}/music/list"> <span
						class="menu-item">音乐管理</span> </a></li>
				<li><a class="sa-side-widget"
					href="${pageContext.request.contextPath}/video/list"> <span
						class="menu-item">视频管理</span> </a></li>
				<li class="active"><a class="sa-side-table"
					href="${pageContext.request.contextPath}/user/list"> <span
						class="menu-item">用户管理</span> </a></li>
				<li><a class="sa-side-folder"
					href="${pageContext.request.contextPath}/music/add"> <span
						class="menu-item">上传音乐</span> </a></li>
				<li><a class="sa-side-calendar"
					href="${pageContext.request.contextPath}/video/add"> <span
						class="menu-item">上传视频</span> </a></li>

			</ul>

		</aside>

		<!-- Content -->
		<section id="content" class="container">



			<!-- Breadcrumb -->
			<ol class="breadcrumb hidden-xs">
				<li><a href="#">Home</a>
				</li>
				</li>
				<li class="active">管理用户</li>
			</ol>

			<h4 class="page-title">TABLES</h4>

			<!-- Deafult Table -->
			<div class="block-area" id="defaultStyle">
				<h3 class="block-title">用户信息</h3>


				<div class="btn-group btn-group-justified m-b-10">
					<a href="${pageContext.request.contextPath}/user/toadd"
						class="btn btn-sm">增加用户</a>

				</div>



				<table class="table tile">
					<thead>
						<tr>
							<th>编号</th>
							<th>账号</th>
							<th>密码</th>
							<th>权限</th>
							<th>操作</th>
						</tr>
					</thead>
					<tbody>
						<c:forEach items="${list }" var="p">
							<tr>
								<td>${p.id}</td>
								<td>${p.userName}</td>
								<td>${p.password}</td>
								<td>
									<div class="make-switch switch-mini"   data-text-label="音乐">
										<input type="checkbox" class="${p.id}" <c:if test="${p.music == '0'}">checked</c:if>>
										<!-- <button type="text" name="music" value="1" onclick="m()">1231</button> -->
									</div>
									<div class="make-switch switch-mini" data-text-label="视频">
										<input type="checkbox" class="${p.id}o" <c:if test="${p.video == '0'}">checked</c:if>>
									</div>
								</td>
								<td><a
									href="${pageContext.request.contextPath}/user/touserupdate?id=${p.id}">修改</a>
									<%-- <a href="javascript:if(confirm('您确定要删除?')){window.location='${pageContext.request.contextPath}/user/userdel?id=${p.id}&currentPage=${requestScope.page.currentPage}'}">
									 删除</a> --%> <a data-toggle="modal" href="#modalNarrower">删除</a>
								</td>
							</tr>

							<!-- Modal Narrower -->
							<div class="modal fade" id="modalNarrower" tabindex="-1"
								role="dialog" aria-hidden="true">
								<div class="modal-dialog modal-sm">
									<div class="modal-content">
										<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal"
												aria-hidden="true">&times;</button>
											<h4 class="modal-title">提示！！</h4>
										</div>
										<div class="modal-body">
											<p>是否删除.</p>
										</div>
										<div class="modal-footer">
											<a type="button" class="btn btn-sm"
												href="${pageContext.request.contextPath}/user/userdel?id=${p.id}">删除</a>
											<button type="button" class="btn btn-sm" data-dismiss="modal">Close</button>
										</div>
									</div>
								</div>
							</div>


							<!-- Responsive Table -->
						</c:forEach>
					</tbody>
				</table>


				<!-- <div class="media text-center">
					<ul class="pagination">
						<li><a href="#"><i class="fa fa-angle-left"></i>
						</a>
						</li>
						<li><a href="#">1</a>
						</li>
						<li><a href="#">2</a>
						</li>
						<li><a href="#">3</a>
						</li>
						<li><a href="#">4</a>
						</li>
						<li><a href="#">5</a>
						</li>
						<li><a href="#"><i class="fa fa-angle-right"></i>
						</a>
						</li>
					</ul>
				</div> -->
				共${requestScope.page.totalSize}条记录&nbsp;&nbsp;<span class="tooltip"></span>
				<div class="media text-center">
					<ul class="pagination">
						</a>
						</li>
						<li>${requestScope.pageString}
						</li>
						</a>
						</li>
					</ul>
				</div>
				
				
	<input type="hidden" value="${requestScope.page.totalPage}" id="totalPage"/> 
    <script type="text/javascript">
		$(document).ready(function(){
			$('.page_s').on('click',function(){
				var count=$(this).attr('lang');
				if(count <= parseInt($('#totalPage').val()) && count >= 1){
				window.location.href="${pageContext.request.contextPath}/user/list?currentPage="+count;
				}
			});
			
			<c:forEach items="${list }" var="p">
				$(".${p.id}").parent().click(function(){
				if($(".${p.id}").parent().hasClass("switch-on"))
				{
				tijiao(${p.id},0);
				}
				else
				{
				 tijiao(${p.id},1);
				 }
			});
			</c:forEach>
		
			<c:forEach items="${list }" var="p">
				$(".${p.id}o").parent().click(function(){
				if($(".${p.id}o").parent().hasClass("switch-on"))
				{
				tijiao1(${p.id},0);
				}
				else
				{
				 tijiao1(${p.id},1);
				 }
			});
			</c:forEach>
			
		});
		
function tijiao(id,val)
{
$.ajax({
			type: 'GET',
			url: "user/update",
			data:  {
				    "id":id,
				    "music":val
				    },
			dataType: 'text',
			
			success:  function(result){	
			}
			});	
//alert(val);
}

function tijiao1(id,val)
{
$.ajax({
			type: 'GET',
			url: "user/update1",
			data:  {
				    "id":id,
				    "video":val
				    },
			dataType: 'text',
			success:  function(result){
			}
			});

}
	
	</script>
		
		<%--  <form action="${pageContext.request.contextPath}/user/userupdate">
                <input type="hidden" id="music" name="music" value="${requestScope.data.music}">
                <input type="hidden" id="video" name="password" value="${requestScope.data.password}">
            </form> --%>

				

			</div>




			<%--  <input type="hidden" value="${requestScope.page.totalPage}" id="totalPage"/>
    <script type="text/javascript">
	$(document).ready(function(){
		$('.page_s').on('click',function(){
			var count=$(this).attr('lang');
			if(count <= parseInt($('#totalPage').val()) && count >= 1){
			window.location.href="${pageContext.request.contextPath}/user/list?currentPage="+count;
			}
		});
		
		
	});
	
</script> --%>





		</section>
		<br />
		<br />
	</section>

	<!-- Javascript Libraries -->
	<!-- jQuery -->
	<script src="${pageContext.request.contextPath}/admin/js/jquery.min.js"></script>
	<!-- jQuery Library -->

	<!-- Bootstrap -->
	<script
		src="${pageContext.request.contextPath}/admin/js/bootstrap.min.js"></script>

	<!--  Form Related -->
	<script
		src="${pageContext.request.contextPath}/admin/js/toggler.min.js"></script>

	<!-- UX -->
	<script src="${pageContext.request.contextPath}/admin/js/scroll.min.js"></script>
	<!-- Custom Scrollbar -->

	<!-- Other -->
	<script
		src="${pageContext.request.contextPath}/admin/js/calendar.min.js"></script>
	<!-- Calendar -->
	<script src="${pageContext.request.contextPath}/admin/js/feeds.min.js"></script>
	<!-- News Feeds -->


	<!-- All JS functions -->
	<script src="${pageContext.request.contextPath}/admin/js/functions.js"></script>

<!-- <script type="text/javascript">
	
		 $('#mu').click(function () {
			
			$("input[name='1']:checked").each(
		
            function (i) {
                _list["selectedIDs[' + i + ']"] = $(this).val();
            });
			
			$.ajax({
			type: 'POST',
			url: "system/user/touserupdate",
			data:  {
				    "music":$("#mu").val(),
				    },
			dataType: 'text',
			
			success:  function(result){
     
					   var m=1;
					   
					   if($("#mu").val()=='0'){
					    $("#mu").val("1");
					   }else{
					    $("#mu").val("0");
					   }
					   
				
			}
		
		});
		});		
</script> -->

</body>
</html>

